import compressPlugin from 'vite-plugin-compression';
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import WindiCSS from "vite-plugin-windicss";  
import path from 'path'


// https://vitejs.dev/config/
export default defineConfig({
  // compressPlugin开启gzip压缩
  plugins: [
    vue(),
    , WindiCSS(),
    compressPlugin({
      ext: ".gz",
      deleteOriginFile: false, // 是否删除原始文件
    }),
  ],
  server: {
    host: "0.0.0.0",  
    proxy: {
      '/dev-api': {
        target: 'http://api.map.baidu.com',
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/dev-api/, '')
      },   
    }
  },
  configureWebpack: {
    externals: {
      'AMap': 'AMap' // 高德地图配置
    }
  },
  resolve: {
    alias: {
      '@': path.join(__dirname, 'src')
    },
  },
});
